
#include <BStream>

using namespace BWE;

bool BStream::move(int offset) const
{
	int pos = this->offset();
	return seek(pos + offset);
}
bool BStream::wmove(int offset)
{
	int pos = this->offset();
	return wseek(pos + offset);
}

bool BStream::begin() const
{
	return size() > 0 && offset() == 0;
}
bool BStream::end() const
{
	return size() > 0 && offset() == size();
}

bool BStream::read(BString& text)
{
	text.reset();
	while (1)
	{
		char c;
		if (0 == read(&c, 1))
			return text.size();
		if (c == 0)
			return text.size();
		text << c;
	}
	return false;
}
bool BStream::write(const BString& text)
{
	return write(text.cstr(), text.size() + 1);
}

